home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996…eptember: Technology Seed / Mac Tech Seed Sep '96 / Mac Tech Seed Sep '96.toast / mac / QuickDraw 3D 1.5d7 / Interfaces / QD3D.h next >
Encoding:
C/C++ Source or Header  |  1996-08-23  |  38.5 KB  |  1,157 lines  |  [TEXT/R*ch]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19. /******************************************************************************
  20.  **                                                                             **
  21.  **                                Porting Control                                 **
  22.  **                                                                             **
  23.  *****************************************************************************/
  24.  
  25. /*
  26.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  27.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  28.  *                2. Add "-DOS_UNIX=1"
  29.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  30.  */
  31. #if defined(_WIN32) || defined(_WINDOWS)
  32.     #define OS_MACINTOSH                0
  33.     #define OS_WIN32                    1
  34.     #define OS_UNIX                        0
  35.  
  36.     #define WINDOW_SYSTEM_MACINTOSH        0
  37.     #define WINDOW_SYSTEM_WIN32            1
  38.     #define WINDOW_SYSTEM_X11            0
  39. #elif !defined(OS_MACINTOSH)
  40.     #define OS_MACINTOSH                1
  41.     #define OS_WIN32                    0
  42.     #define OS_UNIX                        0
  43.  
  44.     #define WINDOW_SYSTEM_MACINTOSH        1
  45.     #define WINDOW_SYSTEM_WIN32            0
  46.     #define WINDOW_SYSTEM_X11            0
  47.  
  48.     #if defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)
  49.          #define PRAGMA_ONCE                1
  50.     #else
  51.          #define PRAGMA_ONCE                0
  52.     #endif  /*  defined(THINK_C) || defined(__SC__) || defined(__MWERKS__)  */
  53.  
  54.     /*
  55.      * Set required compiler options (if possible):
  56.      *   1. enums must always be ints in QD3D and in applications;
  57.      *      this consistency is required to prevent misinterpretation
  58.      *      of an app's enum values by an API; it is also required for
  59.      *      compliance with ANSI
  60.      *   2. alignment of char and short arrays in structures is not on
  61.      *      long boundaries; (could be other way, but must be consistent
  62.      *      in QD3D and in applications)
  63.      *   3. alignment of longs, floats, and pointers in structures
  64.      *      is on long boundaries for PowerPC
  65.      */
  66.     #if defined(THINK_C) || defined(__SC__)
  67.         #pragma options(!pack_enums, !align_arrays)
  68.         #pragma SC options align=power
  69.     #elif defined(__MWERKS__)
  70.         #pragma enumsalwaysint on
  71.         #pragma align_array_members off
  72.         #pragma options align=native
  73.     #elif defined(__PPCC__)
  74.         #pragma options align=power
  75.     #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  76.         #pragma options enum=int
  77.     #endif
  78.     
  79.     enum {
  80.         gestaltQD3D                = 'qd3d',
  81.         gestaltQD3DVersion        = 'q3v ',
  82.         gestaltQD3DNotPresent    = 0,
  83.         gestaltQD3DAvailable    = 1
  84.     };
  85.     
  86. #endif  /*  OS_MACINTOSH  */
  87.  
  88. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  89.     #pragma once
  90. #endif  /*  PRAGMA_ONCE  */
  91.  
  92. /******************************************************************************
  93.  **                                                                             **
  94.  **                                Export Control                                 **
  95.  **                                                                             **
  96.  *****************************************************************************/
  97.  
  98. #if defined(_MSC_VER)    /* Microsoft Visual C */
  99.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  100.         #define QD3D_EXPORT __declspec( dllexport )     
  101.     #else
  102.         #define QD3D_EXPORT __declspec( dllimport )    
  103.     #endif /* WIN32_EXPORTING */
  104. #else
  105.     #define QD3D_EXPORT
  106. #endif  /*  _MSC_VER  */
  107.  
  108.  
  109. /******************************************************************************
  110.  **                                                                             **
  111.  **                                NULL definition                                 **
  112.  **                                                                             **
  113.  *****************************************************************************/
  114.  
  115. #ifndef NULL
  116. #error NULL is undefined.
  117. #endif /* NULL */
  118.  
  119.  
  120. /******************************************************************************
  121.  **                                                                             **
  122.  **                                    Objects                                     **
  123.  **                                                                             **
  124.  *****************************************************************************/
  125. /*
  126.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  127.  * deletion, duplication, and i/o methods.
  128.  */
  129. typedef long                    TQ3ObjectType;
  130.  
  131. typedef struct TQ3ObjectPrivate    *TQ3Object;
  132.  
  133. /*
  134.  * There are four subclasses of OBJECT:
  135.  *    an ELEMENT, which is data that is placed in a SET
  136.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  137.  *    VIEWs, which maintain state information for an image
  138.  *    a PICK, which used to query a VIEW
  139.  */
  140. typedef TQ3Object                TQ3ElementObject;
  141. typedef TQ3Object                TQ3SharedObject;
  142. typedef TQ3Object                TQ3ViewObject;
  143. typedef TQ3Object                TQ3PickObject;
  144.  
  145. /*
  146.  * There are several types of SharedObjects:
  147.  *    RENDERERs, which paint to a drawContext
  148.  *    DRAWCONTEXTs, which are an interface to a device 
  149.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  150.  *    FILEs, which maintain state information for a metafile
  151.  *    SHAPEs, which affect the state of the View
  152.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  153.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  154.  *    TRACKERs, which represent a position and orientation in the user interface
  155.  *  STRINGs, which are abstractions of text string data.
  156.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  157.  *        memory)
  158.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  159.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  160.  */
  161. typedef TQ3SharedObject            TQ3RendererObject;
  162. typedef TQ3SharedObject            TQ3DrawContextObject;
  163. typedef TQ3SharedObject            TQ3SetObject;
  164. typedef TQ3SharedObject            TQ3FileObject;
  165. typedef TQ3SharedObject            TQ3ShapeObject;
  166. typedef TQ3SharedObject            TQ3ShapePartObject;
  167. typedef TQ3SharedObject            TQ3ControllerStateObject;
  168. typedef TQ3SharedObject            TQ3TrackerObject;
  169. typedef TQ3SharedObject            TQ3StringObject;
  170. typedef TQ3SharedObject            TQ3StorageObject;
  171. typedef TQ3SharedObject            TQ3TextureObject;
  172. typedef TQ3SharedObject            TQ3ViewHintsObject;
  173.  
  174. /*
  175.  * There is one types of SET:
  176.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  177.  */
  178. typedef TQ3SetObject                TQ3AttributeSet;
  179.  
  180. /*
  181.  * There are many types of SHAPEs:
  182.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  183.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  184.  *        space
  185.  *    GROUPs, which may contain any number of SHARED OBJECTS
  186.  *    GEOMETRYs, which are representations of three-dimensional data
  187.  *    SHADERs, which affect how colors are drawn on a geometry
  188.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  189.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  190.  *    REFERENCEs, which are references to objects in FILEs
  191.  *  UNKNOWN, which hold unknown objects read from a metafile.
  192.  */
  193. typedef TQ3ShapeObject            TQ3GroupObject;
  194. typedef TQ3ShapeObject            TQ3GeometryObject;
  195. typedef TQ3ShapeObject            TQ3ShaderObject;
  196. typedef TQ3ShapeObject            TQ3StyleObject;
  197. typedef TQ3ShapeObject            TQ3TransformObject;
  198. typedef TQ3ShapeObject            TQ3LightObject;
  199. typedef TQ3ShapeObject            TQ3CameraObject;
  200. typedef TQ3ShapeObject            TQ3UnknownObject;
  201. typedef TQ3ShapeObject            TQ3ReferenceObject;
  202.  
  203. /*
  204.  * For now, there is only one type of SHAPEPARTs:
  205.  *    MESHPARTs, which describe some part of a mesh
  206.  */
  207. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  208.  
  209. /*
  210.  * There are three types of MESHPARTs:
  211.  *    MESHFACEPARTs, which describe a face of a mesh
  212.  *    MESHEDGEPARTs, which describe a edge of a mesh
  213.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  214.  */
  215. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  216. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  217. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  218.  
  219. /*
  220.  * A DISPLAY Group can be drawn to a view
  221.  */
  222. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  223.  
  224. /*
  225.  * There are many types of SHADERs:
  226.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  227.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  228.  */
  229. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  230. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  231.  
  232. /*
  233.  * A handle to an object in a group
  234.  */
  235. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  236.  
  237.  
  238. /******************************************************************************
  239.  **                                                                             **
  240.  **                            Client/Server Things                             **
  241.  **                                                                             **
  242.  *****************************************************************************/
  243.  
  244. typedef void *TQ3ControllerRef;
  245.  
  246.  
  247. /******************************************************************************
  248.  **                                                                             **
  249.  **                            Flags and Switches                                 **
  250.  **                                                                             **
  251.  *****************************************************************************/
  252.  
  253. typedef enum TQ3Boolean {
  254.     kQ3False,
  255.     kQ3True
  256. } TQ3Boolean;
  257.  
  258. typedef enum TQ3Switch {
  259.     kQ3Off,
  260.     kQ3On
  261. } TQ3Switch;
  262.  
  263. typedef enum TQ3Status {
  264.     kQ3Failure,
  265.     kQ3Success
  266. } TQ3Status;
  267.  
  268. typedef enum TQ3Axis {
  269.     kQ3AxisX,
  270.     kQ3AxisY,
  271.     kQ3AxisZ
  272. } TQ3Axis;
  273.  
  274. typedef enum TQ3PixelType {
  275.     kQ3PixelTypeRGB32        = 0,    /* Alpha:8 (ignored), R:8, G:8, B:8    */
  276.     kQ3PixelTypeARGB32        = 1,    /* Alpha:8, R:8, G:8, B:8             */
  277.     kQ3PixelTypeRGB16        = 2,    /* Alpha:1 (ignored), R:5, G:5, B:5    */
  278.     kQ3PixelTypeARGB16        = 3        /* Alpha:1, R:5, G:5, B:5             */
  279. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  280.     ,
  281.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5        */
  282.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8        */
  283. #endif /* WINDOW_SYSTEM_WIN32 */
  284. } TQ3PixelType;
  285.  
  286. typedef enum TQ3Endian{
  287.     kQ3EndianBig,
  288.     kQ3EndianLittle
  289. } TQ3Endian;
  290.  
  291. typedef enum TQ3EndCapMasks {
  292.     kQ3EndCapNone            = 0,
  293.     kQ3EndCapMaskTop        = 1 << 0,
  294.     kQ3EndCapMaskBottom        = 1 << 1,
  295.     kQ3EndCapMaskInterior    = 1 << 2
  296. } TQ3EndCapMasks;
  297.  
  298. typedef unsigned long TQ3EndCap;
  299.  
  300. enum {
  301.     kQ3ArrayIndexNULL = ~0
  302. };
  303.  
  304.  
  305. /******************************************************************************
  306.  **                                                                             **
  307.  **                        Point and Vector Definitions                         **
  308.  **                                                                             **
  309.  *****************************************************************************/
  310.  
  311. typedef struct TQ3Vector2D {
  312.     float        x;
  313.     float        y;
  314. } TQ3Vector2D;
  315.  
  316. typedef struct TQ3Vector3D {
  317.     float         x;
  318.     float        y;
  319.     float        z;
  320. } TQ3Vector3D;
  321.  
  322. typedef struct TQ3Point2D {
  323.     float        x;
  324.     float        y;
  325. } TQ3Point2D;
  326.  
  327. typedef struct TQ3Point3D {
  328.     float         x;
  329.     float        y;
  330.     float        z;
  331. } TQ3Point3D;
  332.  
  333. typedef struct TQ3RationalPoint4D {
  334.     float         x;
  335.     float        y;
  336.     float        z;
  337.     float        w;
  338. } TQ3RationalPoint4D;
  339.  
  340. typedef struct TQ3RationalPoint3D {
  341.     float        x;
  342.     float        y;
  343.     float        w;
  344. } TQ3RationalPoint3D;
  345.  
  346.  
  347. /******************************************************************************
  348.  **                                                                             **
  349.  **                                Quaternion                                     **
  350.  **                                                                             **
  351.  *****************************************************************************/
  352.  
  353. typedef struct TQ3Quaternion {
  354.     float        w;
  355.     float        x;
  356.     float        y;
  357.     float        z;
  358. } TQ3Quaternion;
  359.  
  360.  
  361. /******************************************************************************
  362.  **                                                                             **
  363.  **                                Ray Definition                                 **
  364.  **                                                                             **
  365.  *****************************************************************************/
  366.  
  367. typedef struct TQ3Ray3D {
  368.     TQ3Point3D        origin;
  369.     TQ3Vector3D        direction;
  370. } TQ3Ray3D;
  371.  
  372.  
  373. /******************************************************************************
  374.  **                                                                             **
  375.  **                        Parameterization Data Structures                     **
  376.  **                                                                             **
  377.  *****************************************************************************/
  378.  
  379. typedef struct TQ3Param2D {
  380.     float            u;
  381.     float            v;
  382. } TQ3Param2D;
  383.  
  384. typedef struct TQ3Param3D {
  385.     float            u;
  386.     float            v;
  387.     float            w;
  388. } TQ3Param3D;
  389.  
  390. typedef struct TQ3Tangent2D {
  391.     TQ3Vector3D        uTangent;
  392.     TQ3Vector3D        vTangent;
  393. } TQ3Tangent2D;
  394.  
  395. typedef struct TQ3Tangent3D {
  396.     TQ3Vector3D        uTangent;
  397.     TQ3Vector3D        vTangent;
  398.     TQ3Vector3D        wTangent;
  399. } TQ3Tangent3D;
  400.  
  401.  
  402. /******************************************************************************
  403.  **                                                                             **
  404.  **                        Polar and Spherical Coordinates                         **
  405.  **                                                                             **
  406.  *****************************************************************************/
  407.  
  408.  typedef struct TQ3PolarPoint {
  409.      float        r;
  410.      float        theta;
  411.   } TQ3PolarPoint;
  412.  
  413.  typedef struct TQ3SphericalPoint {
  414.      float        rho;
  415.      float        theta;
  416.      float        phi;
  417.  } TQ3SphericalPoint;
  418.  
  419.  
  420. /******************************************************************************
  421.  **                                                                             **
  422.  **                            Color Definition                                 **
  423.  **                                                                             **
  424.  *****************************************************************************/
  425.  
  426. typedef struct TQ3ColorRGB {
  427.     float             r;
  428.     float            g;
  429.     float            b;
  430. } TQ3ColorRGB;
  431.  
  432.  
  433. typedef struct TQ3ColorARGB {
  434.     float             a;
  435.     float             r;
  436.     float            g;
  437.     float            b;
  438. } TQ3ColorARGB;
  439.  
  440.  
  441. /******************************************************************************
  442.  **                                                                             **
  443.  **                                    Vertices                                 **
  444.  **                                                                             **
  445.  *****************************************************************************/
  446.  
  447. typedef struct TQ3Vertex3D {
  448.     TQ3Point3D            point;
  449.     TQ3AttributeSet        attributeSet;
  450. }  TQ3Vertex3D;
  451.  
  452.  
  453. /******************************************************************************
  454.  **                                                                             **
  455.  **                                    Matrices                                 **
  456.  **                                                                             **
  457.  *****************************************************************************/
  458.  
  459. typedef struct TQ3Matrix3x3 {
  460.     float    value[3][3];
  461. } TQ3Matrix3x3;
  462.  
  463. typedef struct TQ3Matrix4x4 {
  464.     float    value[4][4];
  465. } TQ3Matrix4x4;
  466.  
  467. /******************************************************************************
  468.  **                                                                             **
  469.  **                                Bitmap/Pixmap                                 **
  470.  **                                                                             **
  471.  *****************************************************************************/
  472.  
  473. typedef struct TQ3Pixmap {
  474.     void                *image;
  475.     unsigned long        width;
  476.     unsigned long        height;
  477.     unsigned long        rowBytes;
  478.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  479.                                     /* Interactive Renderer on Mac OS         */
  480.     TQ3PixelType        pixelType;
  481.     TQ3Endian            bitOrder;
  482.     TQ3Endian            byteOrder;
  483. } TQ3Pixmap;
  484.  
  485. typedef struct TQ3StoragePixmap {
  486.     TQ3StorageObject    image;
  487.     unsigned long        width;
  488.     unsigned long        height;
  489.     unsigned long        rowBytes;
  490.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  491.                                     /* Interactive Renderer on Mac OS        */
  492.     TQ3PixelType        pixelType;
  493.     TQ3Endian            bitOrder;
  494.     TQ3Endian            byteOrder;
  495. } TQ3StoragePixmap;
  496.  
  497. typedef struct TQ3Bitmap {
  498.     unsigned char        *image;
  499.     unsigned long        width;
  500.     unsigned long        height;
  501.     unsigned long        rowBytes;
  502.     TQ3Endian            bitOrder;
  503. } TQ3Bitmap;
  504.  
  505. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  506.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  507.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  508.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  509.     unsigned long        offset;        /* Offset from image base to this mipmap */
  510. } TQ3MipmapImage;
  511.  
  512. typedef struct TQ3Mipmap {
  513.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  514.                                     /* if (mipmap==kQ3True) the mipmap data */
  515.     TQ3Boolean            mipmap;        /* True if mipmapping should be used     */
  516.                                     /* and all mipmaps have been provided   */
  517.     TQ3PixelType        pixelType;
  518.     TQ3Endian            bitOrder;
  519.     TQ3Endian            byteOrder;
  520.     unsigned long        reserved;    /* leave NULL for next version */
  521.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  522.                                     /* determined from the size of the         */
  523.                                     /* first mipmap                            */
  524. } TQ3Mipmap;
  525.  
  526.  
  527. /******************************************************************************
  528.  **                                                                             **
  529.  **                        Higher dimension quantities                             **
  530.  **                                                                             **
  531.  *****************************************************************************/
  532.  
  533. typedef struct TQ3Area {
  534.     TQ3Point2D             min;
  535.     TQ3Point2D             max;
  536. } TQ3Area;
  537.  
  538. typedef struct TQ3PlaneEquation {
  539.     TQ3Vector3D            normal;
  540.     float                constant;
  541. } TQ3PlaneEquation;
  542.  
  543. typedef struct TQ3BoundingBox {
  544.     TQ3Point3D             min;
  545.     TQ3Point3D             max;
  546.     TQ3Boolean            isEmpty;
  547. } TQ3BoundingBox;
  548.  
  549. typedef struct TQ3BoundingSphere {
  550.     TQ3Point3D            origin;
  551.     float                radius;
  552.     TQ3Boolean            isEmpty;
  553. } TQ3BoundingSphere;
  554.  
  555. /*
  556.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  557.  *    calls in the View. It's a hint to the system as to how it should 
  558.  *    compute the bbox of a shape:
  559.  *
  560.  *    kQ3ComputeBoundsExact:    
  561.  *        Vertices of shapes are transformed into world space and
  562.  *        the world space bounding box is computed from them.  Slow!
  563.  *    
  564.  *    kQ3ComputeBoundsApproximate: 
  565.  *        A local space bounding box is computed from a shape's
  566.  *        vertices.  This bbox is then transformed into world space,
  567.  *        and its bounding box is taken as the shape's approximate
  568.  *        bbox.  Fast but the bbox is larger than optimal.
  569.  */
  570.  
  571. typedef enum TQ3ComputeBounds {
  572.     kQ3ComputeBoundsExact,
  573.     kQ3ComputeBoundsApproximate
  574. } TQ3ComputeBounds;
  575.  
  576.  
  577. /******************************************************************************
  578.  **                                                                             **
  579.  **                            Object System Types                                 **
  580.  **                                                                             **
  581.  *****************************************************************************/
  582.  
  583. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  584. typedef struct TQ3ObjectClassPrivate        *TQ3ObjectClass;
  585.  
  586. typedef unsigned long                         TQ3MethodType;
  587.  
  588. /*
  589.  * Object methods
  590.  */
  591. #define kQ3MethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  592.  
  593. /*
  594.  * IO Methods
  595.  */
  596. #define kQ3MethodTypeObjectFileVersion    Q3_METHOD_TYPE('v','e','r','s') /* version */
  597. #define kQ3MethodTypeObjectTraverse        Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  598. #define kQ3MethodTypeObjectTraverseData    Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  599. #define kQ3MethodTypeObjectWrite        Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  600. #define kQ3MethodTypeObjectReadData        Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  601.  
  602. typedef void (*TQ3FunctionPointer)(
  603.     void);
  604.  
  605. typedef TQ3FunctionPointer (*TQ3MetaHandler)(
  606.     TQ3MethodType        methodType);
  607.  
  608. /*
  609.  * MetaHandler:
  610.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  611.  *        times to build method tables, and then is thrown away. You are 
  612.  *        guaranteed that your metahandler will never be called again after a 
  613.  *        call that was passed a metahandler returns.
  614.  *
  615.  *        Your metahandler should contain a switch on the methodType passed to it
  616.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  617.  *
  618.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  619.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  620.  *
  621.  *        These types here are prototypes of how your functions should look.
  622.  */
  623.  
  624. typedef TQ3Status (*TQ3ObjectUnregisterMethod)(
  625.     TQ3ObjectClass        objectClass);
  626.     
  627. #endif  /*  QD3D_OBSOLETE  */
  628.  
  629.  
  630. typedef struct TQ3ObjectClassPrivate        *TQ3XObjectClass;
  631.  
  632. typedef unsigned long                         TQ3XMethodType;
  633.  
  634. /*
  635.  * Object methods
  636.  */
  637. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  638.  
  639. /*
  640.  * IO Methods
  641.  */
  642. #define kQ3XMethodTypeObjectFileVersion        Q3_METHOD_TYPE('v','e','r','s') /* version */
  643. #define kQ3XMethodTypeObjectTraverse        Q3_METHOD_TYPE('t','r','v','s') /* byte count */
  644. #define kQ3XMethodTypeObjectTraverseData    Q3_METHOD_TYPE('t','r','v','d') /* byte count */
  645. #define kQ3XMethodTypeObjectWrite            Q3_METHOD_TYPE('w','r','i','t') /* Dump info to file */
  646. #define kQ3XMethodTypeObjectReadData        Q3_METHOD_TYPE('r','d','d','t') /* Read info from file into buffer or, attach read data to parent */ 
  647.  
  648. typedef void (*TQ3XFunctionPointer)(
  649.     void);
  650.  
  651. typedef TQ3XFunctionPointer (*TQ3XMetaHandler)(
  652.     TQ3XMethodType        methodType);
  653.  
  654. /*
  655.  * MetaHandler:
  656.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  657.  *        times to build method tables, and then is thrown away. You are 
  658.  *        guaranteed that your metahandler will never be called again after a 
  659.  *        call that was passed a metahandler returns.
  660.  *
  661.  *        Your metahandler should contain a switch on the methodType passed to it
  662.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  663.  *
  664.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  665.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  666.  *
  667.  *        These types here are prototypes of how your functions should look.
  668.  */
  669.  
  670. typedef TQ3Status (*TQ3XObjectUnregisterMethod)(
  671.     TQ3XObjectClass        objectClass);
  672.     
  673. /*
  674.  * See QD3DIO.h for the IO method types: 
  675.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  676.  */
  677.  
  678.  
  679. /******************************************************************************
  680.  **                                                                             **
  681.  **                                Set Types                                     **
  682.  **                                                                             **
  683.  *****************************************************************************/
  684.  
  685. typedef long                    TQ3ElementType;
  686.  
  687. #define kQ3ElementTypeNone        0
  688. #define kQ3ElementTypeUnknown    32
  689. #define kQ3ElementTypeSet        33
  690. #define kQ3ElementTypeName        34
  691. #define kQ3ElementTypeURL        35
  692.  
  693. /* 
  694.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  695.  *    
  696.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  697.  *        
  698.  *        Note that the object is always referenced when copying around. 
  699.  *        
  700.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  701.  *        group of other "objects" which have been found in the metafile and
  702.  *        have no attachment method to their parent. Be prepared to handle
  703.  *        any or all of these cases if you actually access the set on a shape.
  704.  *
  705.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  706.  *    
  707.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  708.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  709.  *            
  710.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  711.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  712.  *    
  713.  *        Note that the object is always referenced when copying around. 
  714.  *        
  715.  *    See the note below about the Set and Shape changes.
  716.  */
  717.  
  718. /******************************************************************************
  719.  **                                                                             **
  720.  **                            Object System Macros                             **
  721.  **                                                                             **
  722.  *****************************************************************************/
  723.  
  724. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  725.             ((const unsigned long)                     \
  726.             ((const unsigned long) (a) << 24) |     \
  727.             ((const unsigned long) (b) << 16) |        \
  728.             ((const unsigned long) (c) << 8)  |     \
  729.             ((const unsigned long) (d)))
  730.  
  731. #define Q3_OBJECT_TYPE(a,b,c,d) \
  732.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  733.  
  734. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE    
  735. #define Q3_METHOD_TYPE(a,b,c,d) \
  736.     ((TQ3MethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  737. #else
  738. #define Q3_METHOD_TYPE(a,b,c,d) \
  739.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  740.  
  741. #endif  /*  QD3D_OBSOLETE  */
  742.  
  743.  
  744. /******************************************************************************
  745.  **                                                                             **
  746.  **                                Object Types                                 **
  747.  **                                                                             **
  748.  *****************************************************************************/
  749.  
  750. /*
  751.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  752.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  753.  */
  754. #define kQ3ObjectTypeInvalid                            0
  755. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  756. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  757.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  758. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  759.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  760.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  761. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  762.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  763.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  764.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  765.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  766.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  767.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  768.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  769.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  770.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  771.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  772.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  773.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  774.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  775.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  776.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  777.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  778.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  779.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  780.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  781.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  782.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  783.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  784.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  785.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  786.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  787.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  788.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  789.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  790.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  791.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  792.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  793.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  794.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  795.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  796.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  797.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  798.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  799.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  800.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  801.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  802.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  803.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  804.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  805.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  806.             #define kQ3StyleTypeZCompare                Q3_OBJECT_TYPE('z','c','m','p')
  807.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  808.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  809.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  810.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  811.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  812.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  813.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  814.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  815.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  816.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  817.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  818.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  819.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  820.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  821.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  822.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  823.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  824.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  825.     
  826.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  827.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  828.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  829.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  830.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  831.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  832.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  833.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  834.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  835.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  836.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  837.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  838.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  839.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  840.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  841.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  842.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  843.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  844.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  845.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  846.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  847.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  848.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  849.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  850.         #endif  /*  WINDOW_SYSTEM_X11  */
  851.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  852.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  853.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  854.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  855.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  856.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  857.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  858.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  859.             #endif  /*  OS_MACINTOSH  */
  860.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  861.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  862.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  863.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  864.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  865.         #endif  /*  OS_MACINTOSH  */
  866.         #if defined(OS_WIN32) && OS_WIN32
  867.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  868.         #endif  /*  OS_WIN32  */
  869.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  870.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  871.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  872.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  873.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  874.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  875.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  876.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  877.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  878.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  879.     #define kQ3SharedTypeEndGroup                        Q3_OBJECT_TYPE('e','n','d','g')
  880.  
  881.  
  882. #ifdef __cplusplus
  883. extern "C" {
  884. #endif    /* __cplusplus */
  885.  
  886. /******************************************************************************
  887.  **                                                                             **
  888.  **                            QuickDraw 3D System Routines                     **
  889.  **                                                                             **
  890.  *****************************************************************************/
  891.  
  892. QD3D_EXPORT TQ3Status Q3Initialize(
  893.     void);
  894.  
  895. QD3D_EXPORT TQ3Status Q3Exit(
  896.     void);
  897.  
  898. QD3D_EXPORT TQ3Boolean Q3IsInitialized(
  899.     void);
  900.  
  901. QD3D_EXPORT TQ3Status Q3GetVersion(
  902.     unsigned long        *majorRevision,
  903.     unsigned long        *minorRevision);
  904.  
  905.  
  906. /******************************************************************************
  907.  **                                                                             **
  908.  **                            ObjectClass Routines                             **
  909.  **                                                                             **
  910.  *****************************************************************************/
  911.  
  912. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  913. QD3D_EXPORT TQ3Status Q3ObjectClass_Unregister(
  914.     TQ3ObjectClass        objectClass);
  915.  
  916. #endif  /* QD3D_OBSOLETE  */
  917. QD3D_EXPORT TQ3Status Q3XObjectClass_Unregister(
  918.     TQ3XObjectClass        objectClass);
  919.  
  920.  
  921. /******************************************************************************
  922.  **                                                                             **
  923.  **                                Object Routines                                 **
  924.  **                                                                             **
  925.  *****************************************************************************/
  926.  
  927. QD3D_EXPORT TQ3Status Q3Object_Dispose(
  928.     TQ3Object             object);
  929.     
  930. QD3D_EXPORT TQ3Object Q3Object_Duplicate(
  931.     TQ3Object            object);
  932.     
  933. QD3D_EXPORT TQ3Status Q3Object_Submit(
  934.     TQ3Object            object,
  935.     TQ3ViewObject        view);
  936.     
  937. QD3D_EXPORT TQ3Boolean Q3Object_IsDrawable(
  938.     TQ3Object            object);
  939.  
  940. QD3D_EXPORT TQ3Boolean Q3Object_IsWritable(
  941.     TQ3Object            object,
  942.     TQ3FileObject        file);
  943.  
  944.  
  945. /******************************************************************************
  946.  **                                                                             **
  947.  **                            Object Type Routines                             **
  948.  **                                                                             **
  949.  *****************************************************************************/
  950.  
  951. QD3D_EXPORT TQ3ObjectType Q3Object_GetType(
  952.     TQ3Object            object);
  953.  
  954. QD3D_EXPORT TQ3ObjectType Q3Object_GetLeafType(
  955.     TQ3Object            object);
  956.  
  957. QD3D_EXPORT TQ3Boolean Q3Object_IsType(
  958.     TQ3Object            object,
  959.     TQ3ObjectType        type);
  960.  
  961.  
  962. /******************************************************************************
  963.  **                                                                             **
  964.  **                            Shared Object Routines                             **
  965.  **                                                                             **
  966.  *****************************************************************************/
  967.  
  968. QD3D_EXPORT TQ3ObjectType Q3Shared_GetType(
  969.     TQ3SharedObject     sharedObject);
  970.  
  971. QD3D_EXPORT TQ3SharedObject Q3Shared_GetReference(
  972.     TQ3SharedObject     sharedObject);
  973.  
  974. /* 
  975.  *    Q3Shared_IsReferenced
  976.  *        Returns kQ3True if there is more than one reference to sharedObject.
  977.  *        Returns kQ3False if there is ONE reference to sharedObject.
  978.  *    
  979.  *    This call is intended to allow applications and plug-in objects to delete
  980.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  981.  *    caching objects, etc.
  982.  *    
  983.  *    Although many may be tempted, DO NOT DO THIS:
  984.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  985.  *    
  986.  *    Your application will crash and no one will buy it. Chapter 11 is 
  987.  *    never fun (unless you short the stock). Thanks.
  988.  */
  989. QD3D_EXPORT TQ3Boolean Q3Shared_IsReferenced(
  990.     TQ3SharedObject         sharedObject);
  991.  
  992. /*
  993.  *    Q3Shared_GetEditIndex
  994.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  995.  *        object information. Returns 0 on error.
  996.  *        
  997.  *        Hold onto this number to determine if an object has changed since you
  998.  *        last built your caches... To validate, do:
  999.  *        
  1000.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1001.  *            // Cache is valid
  1002.  *        } else {
  1003.  *            // Cache is invalid
  1004.  *            RebuildSomeSortOfCache(foo);
  1005.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1006.  *        }
  1007.  */
  1008. QD3D_EXPORT unsigned long Q3Shared_GetEditIndex(
  1009.     TQ3SharedObject         sharedObject);
  1010.  
  1011. /*
  1012.  *    Q3Shared_Edited
  1013.  *        Bumps the "serial number" of sharedObject to a different value. This
  1014.  *        call is intended to be used solely from a plug-in object which is 
  1015.  *        shared. Call this whenever your private instance data changes.
  1016.  *        
  1017.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1018.  *            QuickDraw 3D isn't initialized.
  1019.  */
  1020. QD3D_EXPORT TQ3Status Q3Shared_Edited(
  1021.     TQ3SharedObject         sharedObject);
  1022.  
  1023.  
  1024. /******************************************************************************
  1025.  **                                                                             **
  1026.  **                                Shape Routines                                 **
  1027.  **                                                                             **
  1028.  *****************************************************************************/
  1029.  
  1030. /*
  1031.  *    QuickDraw 3D 1.1 Note:
  1032.  *
  1033.  *    Shapes and Sets are now (sort of) polymorphic.
  1034.  *
  1035.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1036.  *        The following calls are identical, in implementation:
  1037.  *
  1038.  *            Q3Shape_GetElement            =    Q3Set_Get
  1039.  *            Q3Shape_AddElement            =    Q3Set_Add
  1040.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1041.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1042.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1043.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1044.  *
  1045.  *    All of these calls accept a shape or a set as their first parameter.
  1046.  *
  1047.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1048.  *    element type kQ3ElementTypeSet. See the note above about 
  1049.  *    kQ3ElementTypeSet;
  1050.  *
  1051.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1052.  *    create a set on a shape and then add the element to it. This data is
  1053.  *    attached directly to the shape. Therefore, it is possible for an element
  1054.  *    to exist on a shape without a set existing on it as well. 
  1055.  *
  1056.  *    In your application, if you attach an element to a shape like this:
  1057.  *        (this isn't checking for errors for simplicity)
  1058.  *
  1059.  *        set = Q3Set_New();
  1060.  *        Q3Set_AddElement(set, kMyElemType, &data);
  1061.  *        Q3Shape_SetSet(shape, set);
  1062.  *
  1063.  *    You should retrieve it in the same manner:
  1064.  *
  1065.  *        Q3Shape_GetSet(shape, &set);
  1066.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) {
  1067.  *            Q3Set_Get(set, kMyElemType, &data);
  1068.  *        }
  1069.  *
  1070.  *    Similarly, if you attach data to a shape with the new calls:
  1071.  *
  1072.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  1073.  *
  1074.  *    You should retrieve it in the same manner:
  1075.  *
  1076.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) {
  1077.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  1078.  *        }
  1079.  *
  1080.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1081.  *    metafiles.
  1082.  *
  1083.  *    When attempting to find a particular element on a shape, you should
  1084.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1085.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1086.  *    and then Q3Shape_GetElement(set, ...).
  1087.  *
  1088.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1089.  *    used for sets of information that are shared among multiple shapes.
  1090.  *    
  1091.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1092.  *    for elements that are unique for a particular shape.
  1093.  *    
  1094.  */
  1095. QD3D_EXPORT TQ3ObjectType Q3Shape_GetType(
  1096.     TQ3ShapeObject    shape);
  1097.  
  1098. QD3D_EXPORT TQ3Status Q3Shape_GetSet(
  1099.     TQ3ShapeObject    shape,
  1100.     TQ3SetObject    *set);
  1101.  
  1102. QD3D_EXPORT TQ3Status Q3Shape_SetSet(
  1103.     TQ3ShapeObject    shape,
  1104.     TQ3SetObject     set);
  1105.  
  1106. QD3D_EXPORT TQ3Status Q3Shape_AddElement(
  1107.     TQ3ShapeObject    shape,
  1108.     TQ3ElementType    type,
  1109.     const void        *data);
  1110.  
  1111. QD3D_EXPORT TQ3Status Q3Shape_GetElement(
  1112.     TQ3ShapeObject    shape,
  1113.     TQ3ElementType    type,
  1114.     void            *data);
  1115.     
  1116. QD3D_EXPORT TQ3Boolean Q3Shape_ContainsElement(
  1117.     TQ3ShapeObject    shape,
  1118.     TQ3ElementType    type);
  1119.  
  1120. QD3D_EXPORT TQ3Status Q3Shape_GetNextElementType(
  1121.     TQ3ShapeObject    shape,
  1122.     TQ3ElementType    *type);
  1123.  
  1124. QD3D_EXPORT TQ3Status Q3Shape_EmptyElements(
  1125.     TQ3ShapeObject    shape);
  1126.  
  1127. QD3D_EXPORT TQ3Status Q3Shape_ClearElement(
  1128.     TQ3ShapeObject    shape,
  1129.     TQ3ElementType    type);
  1130.  
  1131.  
  1132. /******************************************************************************
  1133.  **                                                                             **
  1134.  **                            Color Table Routines                             **
  1135.  **                                                                             **
  1136.  *****************************************************************************/
  1137.  
  1138. QD3D_EXPORT TQ3Status Q3Bitmap_Empty(
  1139.     TQ3Bitmap            *bitmap);
  1140.  
  1141. QD3D_EXPORT unsigned long Q3Bitmap_GetImageSize(
  1142.     unsigned long        width,
  1143.     unsigned long        height);
  1144.  
  1145. #ifdef __cplusplus
  1146. }
  1147. #endif  /*  __cplusplus  */
  1148.  
  1149. #if defined(__MWERKS__)
  1150.     #pragma enumsalwaysint reset
  1151. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  1152.     #pragma options enum=reset
  1153. #endif
  1154.  
  1155. #endif /*  QD3D_h  */
  1156.  
  1157.